package cn.javadog.smartbreeding.record.service.impl;

import cn.javadog.smartbreeding.core.service.WeightRecordService;
import cn.javadog.smartbreeding.record.converter.WeightRecordConverter;
import cn.javadog.smartbreeding.core.dto.WeightRecordDTO;
import cn.javadog.smartbreeding.record.entity.WeightRecord;
import cn.javadog.smartbreeding.record.mapper.WeightRecordMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author 余勇
 */
@Service
@com.alibaba.dubbo.config.annotation.Service
public class WeightRecordServiceImpl implements WeightRecordService {

	@Autowired
	private WeightRecordMapper mapper;
	@Autowired
	private WeightRecordConverter converter;

	@Override
	public String save(WeightRecordDTO dto) {
		WeightRecord weightRecord = converter.dto2entity(dto);
		mapper.insert(weightRecord);
		return weightRecord.getId();
	}
}
